package com.hpli.infrastructure.persistent.po;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Table: raffle_activity_account_day
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class RaffleActivityAccountDay {

    private final static SimpleDateFormat dateFormatDay = new SimpleDateFormat("yyyy-MM-dd");

    /**
     * Column: id
     * Type: INT UNSIGNED
     * Remark: 自增ID
     */
    private Integer id;

    /**
     * Column: user_id
     * Type: VARCHAR(32)
     * Remark: 用户ID
     */
    private String userId;

    /**
     * Column: activity_id
     * Type: BIGINT
     * Remark: 活动ID
     */
    private Long activityId;

    /**
     * Column: day
     * Type: VARCHAR(10)
     * Remark: 日期（yyyy-mm-dd）
     */
    private String day;

    /**
     * Column: day_count
     * Type: INT
     * Remark: 日次数
     */
    private Integer dayCount;

    /**
     * Column: day_count_surplus
     * Type: INT
     * Remark: 日次数-剩余
     */
    private Integer dayCountSurplus;

    /**
     * Column: create_time
     * Type: DATETIME
     * Default value: CURRENT_TIMESTAMP
     * Remark: 创建时间
     */
    private Date createTime;

    /**
     * Column: update_time
     * Type: DATETIME
     * Default value: CURRENT_TIMESTAMP
     * Remark: 更新时间
     */
    private Date updateTime;

    public static String currentDay() {
        return dateFormatDay.format(new Date());
    }

}